home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1G8CX9 (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  3.0 KB  |  75 lines

  1. package com.sun.java.swing;
  2.  
  3. import com.sun.java.swing.border.Border;
  4. import com.sun.java.swing.plaf.UIResource;
  5. import java.awt.Color;
  6. import java.awt.Component;
  7. import java.awt.Font;
  8.  
  9. public abstract class LookAndFeel {
  10.    public UIDefaults getDefaults() {
  11.       return null;
  12.    }
  13.  
  14.    public abstract String getDescription();
  15.  
  16.    public abstract String getID();
  17.  
  18.    public abstract String getName();
  19.  
  20.    public void initialize() {
  21.    }
  22.  
  23.    public static void installBorder(JComponent c, String defaultBorderName) {
  24.       Border b = c.getBorder();
  25.       if (b == null || b instanceof UIResource) {
  26.          c.setBorder(UIManager.getBorder(defaultBorderName));
  27.       }
  28.  
  29.    }
  30.  
  31.    public static void installColors(JComponent c, String defaultBgName, String defaultFgName) {
  32.       Color bg = ((Component)c).getBackground();
  33.       if (bg == null || bg instanceof UIResource) {
  34.          ((Component)c).setBackground(UIManager.getColor(defaultBgName));
  35.       }
  36.  
  37.       Color fg = ((Component)c).getForeground();
  38.       if (fg == null || fg instanceof UIResource) {
  39.          ((Component)c).setForeground(UIManager.getColor(defaultFgName));
  40.       }
  41.  
  42.    }
  43.  
  44.    public static void installColorsAndFont(JComponent c, String defaultBgName, String defaultFgName, String defaultFontName) {
  45.       Font f = ((Component)c).getFont();
  46.       if (f == null || f instanceof UIResource) {
  47.          ((Component)c).setFont(UIManager.getFont(defaultFontName));
  48.       }
  49.  
  50.       installColors(c, defaultBgName, defaultFgName);
  51.    }
  52.  
  53.    public abstract boolean isNativeLookAndFeel();
  54.  
  55.    public abstract boolean isSupportedLookAndFeel();
  56.  
  57.    public static Object makeIcon(Class baseClass, String gifFile) {
  58.       return new 1(baseClass, gifFile);
  59.    }
  60.  
  61.    public String toString() {
  62.       return "[" + this.getDescription() + " - " + this.getClass().getName() + "]";
  63.    }
  64.  
  65.    public void uninitialize() {
  66.    }
  67.  
  68.    public static void uninstallBorder(JComponent c) {
  69.       if (c.getBorder() instanceof UIResource) {
  70.          c.setBorder((Border)null);
  71.       }
  72.  
  73.    }
  74. }
  75.